package com.example.communitypro.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

public class Post implements Serializable {
    private Integer postNo;

    private String postTitle;

    private Integer userNo;

    private Integer communityNo;

    private Integer postStatus;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date postTime;

    private Integer postClickNumber;

    private Integer postLikeNumber;

    private Integer postCommentNumber;

    private Integer postCollectionNumber;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endingTime;

    private String postContent;

    private static final long serialVersionUID = 1L;

    public Integer getPostNo() {
        return postNo;
    }

    public void setPostNo(Integer postNo) {
        this.postNo = postNo;
    }

    public String getPostTitle() {
        return postTitle;
    }

    public void setPostTitle(String postTitle) {
        this.postTitle = postTitle == null ? null : postTitle.trim();
    }

    public Integer getUserNo() {
        return userNo;
    }

    public void setUserNo(Integer userNo) {
        this.userNo = userNo;
    }

    public Integer getCommunityNo() {
        return communityNo;
    }

    public void setCommunityNo(Integer communityNo) {
        this.communityNo = communityNo;
    }

    public Integer getPostStatus() {
        return postStatus;
    }

    public void setPostStatus(Integer postStatus) {
        this.postStatus = postStatus;
    }

    public Date getPostTime() {
        return postTime;
    }

    public void setPostTime(Date postTime) {
        this.postTime = postTime;
    }

    public Integer getPostClickNumber() {
        return postClickNumber;
    }

    public void setPostClickNumber(Integer postClickNumber) {
        this.postClickNumber = postClickNumber;
    }

    public Integer getPostLikeNumber() {
        return postLikeNumber;
    }

    public void setPostLikeNumber(Integer postLikeNumber) {
        this.postLikeNumber = postLikeNumber;
    }

    public Integer getPostCommentNumber() {
        return postCommentNumber;
    }

    public void setPostCommentNumber(Integer postCommentNumber) {
        this.postCommentNumber = postCommentNumber;
    }

    public Integer getPostCollectionNumber() {
        return postCollectionNumber;
    }

    public void setPostCollectionNumber(Integer postCollectionNumber) {
        this.postCollectionNumber = postCollectionNumber;
    }

    public Date getEndingTime() {
        return endingTime;
    }

    public void setEndingTime(Date endingTime) {
        this.endingTime = endingTime;
    }

    public String getPostContent() {
        return postContent;
    }

    public void setPostContent(String postContent) {
        this.postContent = postContent == null ? null : postContent.trim();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Post other = (Post) that;
        return (this.getPostNo() == null ? other.getPostNo() == null : this.getPostNo().equals(other.getPostNo()))
                && (this.getPostTitle() == null ? other.getPostTitle() == null : this.getPostTitle().equals(other.getPostTitle()))
                && (this.getUserNo() == null ? other.getUserNo() == null : this.getUserNo().equals(other.getUserNo()))
                && (this.getCommunityNo() == null ? other.getCommunityNo() == null : this.getCommunityNo().equals(other.getCommunityNo()))
                && (this.getPostStatus() == null ? other.getPostStatus() == null : this.getPostStatus().equals(other.getPostStatus()))
                && (this.getPostTime() == null ? other.getPostTime() == null : this.getPostTime().equals(other.getPostTime()))
                && (this.getPostClickNumber() == null ? other.getPostClickNumber() == null : this.getPostClickNumber().equals(other.getPostClickNumber()))
                && (this.getPostLikeNumber() == null ? other.getPostLikeNumber() == null : this.getPostLikeNumber().equals(other.getPostLikeNumber()))
                && (this.getPostCommentNumber() == null ? other.getPostCommentNumber() == null : this.getPostCommentNumber().equals(other.getPostCommentNumber()))
                && (this.getPostCollectionNumber() == null ? other.getPostCollectionNumber() == null : this.getPostCollectionNumber().equals(other.getPostCollectionNumber()))
                && (this.getEndingTime() == null ? other.getEndingTime() == null : this.getEndingTime().equals(other.getEndingTime()))
                && (this.getPostContent() == null ? other.getPostContent() == null : this.getPostContent().equals(other.getPostContent()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getPostNo() == null) ? 0 : getPostNo().hashCode());
        result = prime * result + ((getPostTitle() == null) ? 0 : getPostTitle().hashCode());
        result = prime * result + ((getUserNo() == null) ? 0 : getUserNo().hashCode());
        result = prime * result + ((getCommunityNo() == null) ? 0 : getCommunityNo().hashCode());
        result = prime * result + ((getPostStatus() == null) ? 0 : getPostStatus().hashCode());
        result = prime * result + ((getPostTime() == null) ? 0 : getPostTime().hashCode());
        result = prime * result + ((getPostClickNumber() == null) ? 0 : getPostClickNumber().hashCode());
        result = prime * result + ((getPostLikeNumber() == null) ? 0 : getPostLikeNumber().hashCode());
        result = prime * result + ((getPostCommentNumber() == null) ? 0 : getPostCommentNumber().hashCode());
        result = prime * result + ((getPostCollectionNumber() == null) ? 0 : getPostCollectionNumber().hashCode());
        result = prime * result + ((getEndingTime() == null) ? 0 : getEndingTime().hashCode());
        result = prime * result + ((getPostContent() == null) ? 0 : getPostContent().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", postNo=").append(postNo);
        sb.append(", postTitle=").append(postTitle);
        sb.append(", userNo=").append(userNo);
        sb.append(", communityNo=").append(communityNo);
        sb.append(", postStatus=").append(postStatus);
        sb.append(", postTime=").append(postTime);
        sb.append(", postClickNumber=").append(postClickNumber);
        sb.append(", postLikeNumber=").append(postLikeNumber);
        sb.append(", postCommentNumber=").append(postCommentNumber);
        sb.append(", postCollectionNumber=").append(postCollectionNumber);
        sb.append(", endingTime=").append(endingTime);
        sb.append(", postContent=").append(postContent);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}